package com.java.controller;

import com.github.pagehelper.PageInfo;
import com.java.model.Platform;
import com.java.model.Result;
import com.java.service.PlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/platform")
public class PlatformController {

    @Autowired
    private PlatformService platformService;

    @GetMapping("typeList")
    public String toList(){
        return"/system/type/list";
    }

    @GetMapping("classifyList")
    public String classifyList(){
        return"/system/classify/list";
    }

    @PostMapping("list")
    @ResponseBody
    public Result list(Platform platform){
        PageInfo<Platform> pageInfo = platformService.list(platform);
        return Result.success(pageInfo.getList(),pageInfo.getTotal());
    }


}
